var n;
Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.TipMgr = undefined;
var BundleConfig = require("AA_BundleConfig");
var UI_Toast = require("AA_UI_Toast");
var ResLoader = require("AA_ResLoader");
var SingletonManager = require("AA_SingletonManager");
var s = function (e) {
  function t() {
    var t = null !== e && e.apply(this, arguments) || this;
    t._toast = null;
    t._isLoadRes = false;
    return t;
  }
  __extends(t, e);
  t.prototype.showToast = function (e) {
    if (e) {
      if (this._toast) {
        this._doToast(e);
      } else {
        this._getToast(e);
      }
    }
  };
  t.prototype.cleanToast = function () {
    if (this._toast) {
      this._toast.destroy();
      this._toast = null;
      this._isLoadRes = false;
    }
  };
  t.prototype._getToast = function (e) {
    var t = this;
    if (!this._isLoadRes) {
      this._isLoadRes = true;
      ResLoader.default.loadRes(BundleConfig.BundleNames.Resouce, "res/common/UI_Toast", cc.Prefab).then(function (o) {
        t._toast = cc.instantiate(o);
        cc.director.getScene().getChildByName("Canvas").getChildByName("UITips").addChild(t._toast);
        t._doToast(e);
      });
    }
  };
  t.prototype._doToast = function (e) {
    if (this._toast) {
      var t = this._toast.getComponent(UI_Toast.default);
      t && t.show(e);
    }
  };
  return t;
}(SingletonManager.SingletonMgr);
exports.TipMgr = s.getInstance();